import JSEncrypt from "jsencrypt";
// publicKey 公钥 privateKey 私钥
function RSA(publicKey, privateKey) {
    let encryptObject = new JSEncrypt();
    let decryptObject = new JSEncrypt();

    encryptObject.setKey(publicKey);
    decryptObject.setKey(privateKey);
    //encrypt 传值加密 不传解密
    return function(data, encrypt) {
        return encrypt ? encryptObject.encrypt(data) : decryptObject.decrypt(data);
    };
}

export default RSA;